Some existing systems share devices between entities such as virtual machines (VMs), user mode driver applications, and kernel mode drivers. An operating system (OS) acts as an interface between the computer hardware and the user and, as such, is responsible for managing and coordinating the requests that user applications make to the computer hardware. The operating system divides the software running in the computer into different layers, such as the user space and kernel layers. The hardware layer of a computer may include the hardware of the computer such as buses, universal serial bus (USB) host controller devices, and peripheral devices attached to the computer. USB devices connect to the host computer system through the USB hub, USB host controller device, and USB bus.
Specific software modules are generally used to control devices that attach to the computer system through USB, peripheral component interconnect (PCI), and/or other methods. It is advantageous to have these specific software modules rather than having to program the kernel to control input/output (I/O) of attached devices at least because the kernel would need to be programmed to handle the I/O of every device that may be developed to attach to the computer. These software modules are referred to as device drivers. The device drivers act as translators that convert the more general I/O instructions of the operating system to messages that can be understood by a specific device type with which that device driver is associated. Examples of device drivers are kernel mode USB driver and user mode USB drivers. Kernel mode USB drivers are loaded by the kernel and run with full privileges. Kernel mode USB drivers translate system calls from user mode applications to specific I/O commands. User mode USB drivers run in user space with user privilege and communicate with USB devices through I/O commands to the kernel.
USB passthrough operation for a VM is an application that runs in the user space and acts as a user mode driver. VM passes commands to a hypervisor that in turns passes them to a USB passthrough operation that in turns passes them to a USB host controller. By USB passthrough operation, the USB devices may be given in their entirety to the VM. Similarly, with PCI passthrough operation, a USB host controller device may be passed as a PCI device to a VM. PCI passthrough operation gives control of physical devices to VMs. PCI passthrough operation can be used to assign a PCI device (e.g., network interface card, disk controller, host bus adapter, USB controller, FIREWIRE brand controller, soundcard, etc.) to a VM guest, giving it full and direct access to the PCI device. To avoid conflicts, sharing of USB devices should be done in such a manner that no entity can claim a device that another entity has currently claimed. Some existing systems allow entities to notify the claiming entity and allow it to shut down its session cleanly. Further, with some of the existing systems, all USB hubs and USB host controller devices may be reserved for the hypervisor kernel. However, sharing USB devices in these ways limits access to these devices and places burdens on the computing device.